package com.ruoyi.api.controller;

import com.ruoyi.api.domain.Courier;
import com.ruoyi.api.service.ICourierService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 快递员
 *
 * @author 寻觅
 * @since 2025-06-13
 */
@RestController
@RequestMapping("courier")
public class CourierController extends BaseController {

    @Autowired
    ICourierService iCourierService;

    /**
     * 根据公司id查询快递员列表
     * @param companyId
     * @return
     */
    @PostMapping("list")
    public TableDataInfo list(@RequestParam Integer companyId) {
        startPage();
        return getDataTable(iCourierService.listData(companyId));
    }

    /**
     * 添加修改
     * @param courier
     * @return
     */
    @PostMapping("addOrUp")
    public AjaxResult addOrUp(@RequestBody Courier courier) {
        return AjaxResult.success(iCourierService.addOrUp(courier));
    }
}
